﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICeFramework.DataManagement.Interfaces;
using Microsoft.SqlServer.Management.Smo;
using ICeFramework.DataManagement.Collections;

namespace ICeFramework.DataManagement.MSSql
{
    /// <summary>
    /// </summary>
    /// <remarks></remarks>
    /// <example></example>
    public class MSSqlView : IView
    {
        private View _view = null;

        public MSSqlView(View view)
        {
            _name = view.Name;
            _view = view;
        }

        public void GetColumns()
        {
            _columns.Clear();
            foreach (Column col in _view.Columns)
            {
                IColumn msSqlCol = new MSSqlColumn(this, col);
                _columns.Add(msSqlCol);
            }
        }

        private string _name;
        #region public string Name
        /// <summary>
        /// Get/Sets the Name of the MSSqlView
        /// </summary>
        /// <value></value>
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }
        #endregion

        private SqlColumnList _columns = new SqlColumnList();
        #region public SqlColumnList Columns
        /// <summary>
        /// Get/Sets the Columns of the MSSqlView
        /// </summary>
        /// <value></value>
        public SqlColumnList Columns
        {
            get
            {
                return _columns;
            }
            set
            {
                _columns = value;
            }
        }
        #endregion
    }
}
